package cn.accp.mvc.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

public class MyInterceptor implements HandlerInterceptor{
	//在DispatcherServlet处理之后执行---清理工作
	public void afterCompletion(HttpServletRequest request,
			HttpServletResponse response, Object object, Exception exception)
			throws Exception {
		System.out.println("-----在DispatcherServlet处理之后执行---清理工作");
	}
	//在请求处理的方法之后执行
	public void postHandle(HttpServletRequest request, HttpServletResponse response,
			Object object, ModelAndView modelAndView) throws Exception {
		System.out.println("------在请求处理的方法之后执行");
	}
	//在请求处理的方法之前执行过
	//如果返回true那么执行下一个拦截器，
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
			Object object) throws Exception {
		System.out.println("----在请求处理的方法之前执行过");
		return true;
	}

}
